package com.yoso.thread;

import lombok.SneakyThrows;

import java.util.concurrent.ExecutorService;

/**
 * @author shizejin
 * @date 2021/12/31
 * @description:
 */
public class Main {
    @SneakyThrows
    public static void main(String[] args) {
        ExecutorService executorService = MyThreadPool.getInstance();
        MyThread myThread = new MyThread("线程1");
        MyThread myThread2 = new MyThread("线程2");
        executorService.execute(myThread);

        executorService.execute(myThread2);
        for (int i = 0; i < 10; i++) {
            Thread.sleep(300);
            System.out.println(Thread.currentThread().getName() + "---" + i);
        }
    }

}
